const CryptoJS = require("crypto-js");
// var t1 = 'ct=pc&permanent_id=20250908154103623237031321465926873&requestId=2509081541045960f0GWhe_a615&t=1757317281441';
var t2 = 'ct=pc&permanent_id=20250908154103623237031321465926873&requestId=2509081541045960f0GWhe_a615&situation=login&t=1757318973242';
var t3 = 'ct=pc&need_new_verifydata=0&permanent_id=20250908154103623237031321465926873&point_json=NRi+wU5RsS95VV7M5Gla6VtfCvf4fFE9Qq97jzMMsg62XDFKoXehnSk6xnGEFZxT&requestId=2509081612007240LJBN6g_619b&situation=login&slide_cost_time=1244&t=1757320540406&verifyToken=c58f099702c84c229f35b1290dd76d51'
J = function (t) {
    return CryptoJS.MD5(t).toString()
};
U = CryptoJS.enc.Utf8.parse("0102030405060708");
Y = function (t, e) {
    e = CryptoJS.enc.Utf8.parse(e);
    var n = CryptoJS.enc.Utf8.parse(t);
    return CryptoJS.AES.encrypt(n, e, {
        iv: U
    }).toString()
};
function gerankeysign(a) {
    var parr = {
        "ct": a['ct'],
        "permanent_id": a['permanent_id'],
        "requestId": a['requestId'],
        "t": parseInt(a['t'])
    };
    var params = new URLSearchParams(parr);
    var r = params.toString();


    r = J(r);
    r = Y(r, "");
    sign = r;
    return sign;
}
function generateSignature(a, rankey) {
    var parr = {
        "ct": a['ct'],
        "permanent_id": a['permanent_id'],
        "requestId": a['requestId'],
        "t": parseInt(a['t'])
    };
    var params = new URLSearchParams(parr);
    var r = params.toString();


    r = J(r);
    r = Y(r, rankey);
    sign = r;
    return sign;
}
function generateSignature2(a, rankey) {
    var parr = {
        "ct": a['ct'],
        "permanent_id": a['permanent_id'],
        "requestId": a['requestId'],
        "situation": a['situation'],
        "t": parseInt(a['t'])
    };
    var params = new URLSearchParams(parr);
    var r = params.toString();


    r = J(r);
    r = Y(r, rankey);
    sign = r;
    return sign;
}


function generateSignature3(a, rankey, verifyToken) {
    parr = {
        "ct": a['ct'],
        "need_new_verifydata": parseInt(a['need_new_verifydata']),
        "permanent_id": a['permanent_id'],
        "point_json": a['point_json'],
        "requestId": a['requestId'],
        "situation": a['situation'],
        "slide_cost_time": parseInt(a['slide_cost_time']),
        "t": parseInt(a['t']),
        "verifyToken": verifyToken
    }
    
    var params = new URLSearchParams(parr);
    var r = params.toString();


    r = J(r);
    r = Y(r, rankey);
    sign = r;
    return sign;
}
function generatePointJson(left, y, rankey) {
    p1 = JSON.stringify({
        x: left / 350,
        y: y
    });
    return Y(p1, rankey);
}
// console.log(generatePointJson(264, 0.50490195, "9T038HseN8lhizEb"))
// console.log(J(t2));
// console.log(J(t3));
// console.log(Y(J(t2), "3RYTCfQBTraDjp9g"));